function rn = ShturmTheorem(fx, a, b)
fx = sym(fx);
a = double(sym(a));
b = double(sym(b));
if b < a
    rn = 0;
    return
end;
fx = sym(fx);
P = sym2poly(fx);
series = sym(zeros(size(P)));
series(1) = fx;
series(2) = diff(fx);
i = 2;
while (~IsNumeric(series(i)))
    i = i + 1;
    Pi = sym2poly(series(i - 2));
    Pk = sym2poly(series(i - 1));
    [q, res] = deconv(Pi, Pk);
    if i > size(series);
        series = [series, zeros(size(series))];
    end;
    series(i) = - poly2sym(res);
end;
S = series(1 : i);
Pa = subs(S, a);
Pb = subs(S, b);
rn = CountSignChanges(Pa) - CountSignChanges(Pb);
end

